import 'package:dio/dio.dart';

Dio initDio() {
  BaseOptions baseOptions = BaseOptions(
    baseUrl: 'https://api.it120.cc/b956ecefe528bcc1fd922fd4458913d9',
  );

  Dio dio = Dio(baseOptions);
  dio.interceptors.add(
    InterceptorsWrapper(
      onRequest:(options, handler) async {
        print('Request: ${options.path}');
        handler.next(options);
      },

      onResponse: (response, handler) {
        print('Response: ${response.statusCode}');
        handler.next(response);
      },

      onError: (error, handler) {
        print('Error: ${error.message}');
        // handler.next(error);
      },
    )
  );

  return dio;
}